home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / doors_1 / fd200.zip / FD_INIT.PAS < prev    next >
Pascal/Delphi Source File  |  1988-02-27  |  5KB  |  196 lines

  1. procedure save_init;
  2. var  init_file : text;
  3. begin
  4.   assign(init_file,'INIT.FDY');
  5.   rewrite(init_file);
  6.   writeln(init_file,default_file);
  7.   writeln(init_file,my_mult);
  8.   writeln(init_file,norm_b:3,norm_f:3);
  9.   writeln(init_file,brite_b:3,brite_f:3);
  10.   if auto_section = TRUE
  11.     then writeln(init_file,'Y')
  12.     else writeln(init_file,'N');
  13.   if tunes = TRUE
  14.     then writeln(init_file,'Y')
  15.     else writeln(init_file,'N');
  16.   close(init_file);
  17. end;
  18.  
  19. procedure read_init;
  20. var  init_file : text;
  21.      dmy : any_string;
  22.      i, c1, c2 : integer;
  23.      c : char;
  24. begin
  25.   default_file := 'FIELD.DAY';
  26.   auto_section := TRUE;
  27.   tunes := TRUE;
  28.   assign(init_file,'INIT.FDY');
  29.   {$I-}
  30.   reset(init_file);
  31.   if (IOresult = 0 ) then
  32.   begin
  33.     c1 := 1; c2 := 1;
  34.     readln(init_file,dmy);
  35.     if pos(';',dmy) > 0 then               { find comment field if any }
  36.       dmy := copy(dmy,1,pos(';',dmy)) + ' ';
  37.     while(dmy[c1]=' ') do                  { strip leading blanks }
  38.       begin
  39.         c1 := c1 + 1;
  40.         c2 := c2 + 1;
  41.       end;
  42.     c2 := c2 + 1;
  43.     while (dmy[c2] <> ' ') do              { strip trailing blanks }
  44.       c2 := c2 + 1;
  45.     default_file := copy(dmy,c1,c2-c1);
  46.     read(init_file,my_mult); readln(init_file);
  47.     read(init_file,norm_b);
  48.     read(init_file,norm_f);  readln(init_file);
  49.     read(init_file,brite_b);
  50.     read(init_file,brite_f); readln(init_file);
  51.     read(init_file,c); readln(init_file);
  52.     if c in ['y','Y'] then auto_section := TRUE;
  53.     read(init_file,c); readln(init_file);
  54.     if c in ['y','Y'] then tunes := TRUE;
  55.     close(init_file);
  56.   end;
  57.   band := B160;
  58.   op_mode := CW;
  59.   tbranch^.leaf.xmtmode := op_mode;
  60.   tbranch^.leaf.band := band;
  61.   tbranch^.leaf.callsign := '';
  62.   tbranch^.leaf.section := '';
  63.   tbranch^.leaf.date := '';
  64.   tbranch^.leaf.time := '';
  65.   for i := 0 to 10 do contacts[i] := 0;
  66.   total_contacts := 0;
  67.   score := 0;
  68. end;
  69.  
  70. procedure b_w;
  71. begin
  72.   textcolor(7);
  73.   textbackground(0);
  74. end;
  75.  
  76. procedure what_color(i : integer);
  77. begin
  78.     case i of
  79.       0 : write ('BLACK        ');
  80.       1 : write ('BLUE         ');
  81.       2 : write ('GREEN        ');
  82.       3 : write ('CYAN         ');
  83.       4 : write ('RED          ');
  84.       5 : write ('MAGENTA      ');
  85.       6 : write ('BROWN        ');
  86.       7 : write ('WHITE        ');
  87.       8 : write ('GRAY         ');
  88.       9 : write ('LIGHT BLUE   ');
  89.       10 : write('LIGHT GREEN  ');
  90.       11 : write('LIGHT CYAN   ');
  91.       12 : write('LIGHT RED    ');
  92.       13 : write('LIGHT MAGENTA');
  93.       14 : write('YELLOW       ');
  94.       15 : write('BRIGHT WHITE ');
  95.     end;
  96.   hide_cursor;
  97. end;
  98.  
  99. procedure sho_auto;
  100. begin
  101.   gotoxy(52,6);
  102.   b_w;
  103.   if auto_section = TRUE then writeln('SECTION LIST')
  104.                          else writeln('MANUAL ENTRY');
  105.   hide_cursor;
  106. end;
  107.  
  108. procedure sho_tunes;
  109. begin
  110.   gotoxy(52,7);
  111.   b_w;
  112.   if tunes = TRUE then writeln('ON ')
  113.                   else writeln('OFF');
  114.   hide_cursor;
  115. end;
  116.  
  117. procedure sho_norm;
  118. begin
  119.   normcolor;
  120.   gotoxy(52,8); what_color(norm_b);
  121.   gotoxy(52,9); what_color(norm_f);
  122.   b_w;
  123. end;
  124.  
  125. procedure sho_brit;
  126. begin
  127.   brite_color;
  128.   gotoxy(52,10); what_color(brite_b);
  129.   gotoxy(52,11); what_color(brite_f);
  130.   b_w;
  131. end;
  132.  
  133. procedure sho_default;
  134. begin
  135.   b_w; gotoxy(52,12); ClrEol; write(default_file);
  136. end;
  137.  
  138. procedure setup;
  139. var skey : char;
  140. begin
  141.   b_w;
  142.   window(1,1,80,25);
  143.   clrscr;
  144.   gotoxy(20,6); write('<1> Selection Mode ............'); sho_auto;
  145.   gotoxy(20,7); write('<2> Sound .....................'); sho_tunes;
  146.   gotoxy(20,8); write('<3> Normal Background Color ...'); sho_norm;
  147.   gotoxy(20,9); write('<4> Normal Forground color ....'); sho_norm;
  148.   gotoxy(20,10); write('<5> Hi-lite Background color ..'); sho_brit;
  149.   gotoxy(20,11); write('<6> Hi-lite Forground color ...'); sho_brit;
  150.   gotoxy(20,12); write('<7> Default Log Path/Filename .'); sho_default;
  151.   gotoxy(20,13); write('<S> Save init values to INIT.FDY');
  152.   gotoxy(20,15); write('<ESC> done');
  153.   hide_cursor;
  154.   repeat
  155.     skey := readkey;
  156.     case skey of
  157.      '1' : begin
  158.              auto_section := NOT auto_section;
  159.              sho_auto;
  160.            end;
  161.      '2' : begin
  162.              tunes := NOT tunes;
  163.              sho_tunes;
  164.            end;
  165.      '3' : begin
  166.              norm_b := (norm_b + 1) AND 7;
  167.              sho_norm;
  168.            end;
  169.      '4' : begin
  170.              norm_f := (norm_f + 1) AND 15;
  171.              sho_norm;
  172.            end;
  173.      '5' : begin
  174.              brite_b := (brite_b + 1) AND 7;
  175.              sho_brit;
  176.            end;
  177.      '6' : begin
  178.              brite_f := (brite_f + 1) AND 15;
  179.              sho_brit;
  180.            end;
  181.      '7' : begin
  182.              gotoxy(52,12); ClrEol;
  183.              readln(default_file);
  184.              UpperCase(default_file);
  185.              sho_default;
  186.            end;
  187.      'S','s' : save_init;
  188.      #0 : skey := readkey;
  189.     end;
  190.   until skey = #27;
  191.   color_image;
  192.   normcolor;
  193. end;
  194.  
  195.  
  196.